@import '~antd/lib/style/themes/default.less';

@side-width: 200px;

.container {
  background-color: #fff;
  border: 1px solid #e8e8e8;
}

.left {
  width: @side-width;
  overflow-x: hidden;
  overflow-y: auto;
  box-shadow: 0 2px 4px 0 hsla(0, 0%, 68.2%, 0.5);
}

.iconCard {
  display: inline-block;
  width: 50%;
  padding: 0 4px;
  text-align: center;
  .icon {
    color: @text-color-secondary;
    font-size: 22px;
  }
  .label {
    font-size: 12px;
    line-height: 18px;
  }
}

.dragItem {
  padding: 4px;
  border: 1px dashed transparent;
  cursor: grab;
  &:hover {
    // color: @text-color;
    border: 1px dashed @blue-5 !important;
  }

  .title {
    padding-left: 6px;
    color: @heading-color;
    line-height: 100%;
    .action {
      float: right;
      margin-top: 3px;
      cursor: pointer;
      &:hover {
        color: @primary-color;
      }
    }
  }

  .label {
    margin-top: 4px;
    color: @text-color-secondary;
    font-size: 12px;
    line-height: 100%;
  }
}

.tabs {
  height: 100%;
  margin-bottom: 0;
  overflow-y: auto;
  :global {
    .ant-tabs-bar {
      margin-bottom: 0;
      // background-color: #f3f3f3;
    }
    .ant-tabs-top-content {
      height: calc(100% - 34px);
      // overflow-x: hidden;
      // overflow-y: auto;
    }

    .ant-tabs-nav-animated,
    .ant-tabs-nav-container {
      width: @side-width - 17;
      transform: none !important;
    }
    .ant-tabs-nav-container {
      margin-left: 8px;
    }
    .ant-tabs-nav-container-scrolling {
      padding: 0 !important;
    }
    .ant-tabs-tab-prev,
    .ant-tabs-tab-next {
      display: none !important;
      width: 0 !important;
    }
    .ant-tabs-tab {
      width: 50%;
      margin: 0 !important;
      padding: 8px 0;
      color: @text-color-secondary;
      text-align: center;
      &.ant-tabs-tab-active {
        color: @blue-6;
      }
    }
    .ant-tabs-ink-bar-animated {
      // transform: none !important;
      width: 99px !important;
    }

    .ant-collapse {
    }
    .ant-collapse-header {
      padding: 6px 16px !important;
      color: @text-color !important;
      // background: #f3f3f3;
      // &:hover {
      //   background-color: #e9e9e9;
      // }
    }
    // .ant-collapse-item-active {
    //   > .ant-collapse-header {
    //     border-bottom: 1px solid #d9d9d9;
    //   }
    // }
    .ant-collapse-content-box {
      padding: 0 8px !important;
    }
    .ant-collapse-item {
      border-bottom: none !important;
    }
    .ant-collapse-item:last-child {
      border-bottom: none;
      .ant-collapse-content {
        .ant-collapse-content-box {
          border-bottom: none;
        }
      }
    }
  }
}

.right {
  width: @side-width;
  overflow-x: hidden;
  overflow-y: auto;
  box-shadow: 0 2px 4px 0 hsla(0, 0%, 68.2%, 0.5);

  > div {
    height: 100%;
  }

  :global {
    .ant-slider {
      margin-top: 4px;
    }
  }
}

.configForm {
  height: 100%;
  :global {
    .ant-form-item-label {
      margin-bottom: 4px;
      > label {
        color: @heading-color;
      }
    }
    .ant-form-item {
      margin-top: 8px;
      margin-bottom: 16px;
    }

    .ant-list-item {
      span {
        flex: 1;
      }
    }
    .ant-list-item-action {
      margin-left: 8px;
    }
  }
}

.main {
  overflow: hidden;

  .toolbar {
    height: 34px;
    padding: 4px 8px;
    line-height: 28px;
    // background-color: #f3f3f3;
    border-bottom: 1px solid #e8e8e8;

    .action {
      padding: 0 6px;
      color: @text-color-secondary;
      font-size: 16px;
      cursor: pointer;
      :hover {
        color: @primary-color;
      }
    }
  }

  .canvas {
    overflow-y: auto;
    // background-color: #f5f5f5;
    background: #f5f5f5
      url()
      repeat;
    // border: 3px dashed #ccc;
    &:hover {
      // overflow-y: auto;
    }
    > div {
      height: 100%;
    }
  }

  .editItem {
    position: relative;
    padding: 8px;
    border: 1px dashed transparent;
    cursor: move;

    .actionBar {
      position: absolute;
      top: -12px;
      right: -10px;
      z-index: 1;
      display: none;
      opacity: 0.95;
    }

    .action {
      display: inline-block;
      width: 20px;
      height: 20px;
      color: @blue-5;
      font-size: 20px;
      line-height: 20px;
      text-align: center;
      background-color: #fff;
      border-radius: 50%;
      cursor: pointer;
    }

    &:global(.selected) {
      > .actionBar {
        display: block;
        .action:hover {
          color: @error-color;
        }
      }

      background-color: #ecf5ff;
      border-color: @blue-5;
    }
  }
}

.megaLayoutFix {
  :global {
    .ant-form-item-control-wrapper
      > .ant-form-item-control
      > .ant-form-item-children
      > .mega-layout-container-wrapper
      .ant-form-item-label
      label,
    .ant-form-item-control-wrapper
      > .ant-form-item-control
      > .ant-form-item-children
      > .mega-layout-item-content {
      height: 24px !important;
      font-size: 13px !important;
      line-height: 24px !important;
    }

    /* fix */
    .ant-form-item-control-wrapper
      > .ant-form-item-control
      > .ant-form-item-children
      > .mega-layout-item-content
      > button[role='switch'] {
      flex: none !important;
      width: auto !important;
    }
  }
}

.slickForm {
  :global {
    .ant-card-body {
      min-height: 50px;
    }

    .ant-form-item {
      // margin-bottom: 0 !important;

      .ant-form-item-children {
        height: auto !important;

        textarea {
          margin-bottom: 0;
        }

        .ant-calendar-picker {
          width: 100%;
        }
      }
    }
  }

  &:global(.ant-form-horizontal) {
    :global(.ant-form-item-label) {
      padding-bottom: 2px;
    }
    :global(.ant-upload-list-item) {
      margin-top: 0;
    }
  }

  .section {
    margin-top: 0 !important;
    margin-bottom: 8px !important;
    &:last-child {
      margin-bottom: 0;
    }
  }

  &.editMode {
    :global {
      .ant-form-item {
        margin-bottom: 0 !important;
      }
      .mega-layout-item .ant-form-item-control-wrapper::after {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 8;
        display: block;
        content: '';
      }
      // .ant-form-item {
      //   margin-bottom: 0 !important;
      // }

      .ant-form-item-control-wrapper
        > .ant-form-item-control
        > .ant-form-item-children
        > .mega-layout-container-wrapper
        > .mega-layout-container-content.grid {
        grid-row-gap: 0 !important;
        grid-column-gap: 16px !important;
      }
    }

    > .editItem {
      border-color: #ddd;
    }

    :global(.sticky-container) {
      bottom: 9px !important;
    }
  }

  &.viewMode,
  &.readOnly {
    background-color: #fff;
    :global {
      // .ant-form-item {
      //   margin-top: 8px;
      // }

      .ant-form-item-control-wrapper
        > .ant-form-item-control
        > .ant-form-item-children
        > .mega-layout-container-wrapper
        > .mega-layout-container-content.grid {
        grid-row-gap: 16px !important;
        grid-column-gap: 16px !important;
      }
    }

    /* view模式 card标题分割线调整 */
    > :global(.ant-card) {
      > :global(.ant-card-head) {
        border-top: transparent;
        border-bottom-color: transparent;
      }
      // &:first-child {
      //   > :global(.ant-card-head) {
      //     border-top: 1px solid transparent;
      //     border-bottom-color: transparent;
      //   }
      // }
    }

    /* 针对Async组件 */
    :global(.ant-spin-nested-loading) {
      > :global(.ant-spin-container) {
        > :global(.ant-card) {
          > :global(.ant-card-head) {
            border-top: transparent;
            border-bottom-color: transparent;
          }
          // &:first-child {
          //   > :global(.ant-card-head) {
          //     border-top: 1px solid #e8e8e8 !important;
          //     border-bottom-color: transparent !important;
          //   }
          // }
        }
      }
    }
  }

  .title {
    padding: 16px;
    background-color: #fff;
  }

  &:global(.cute) {
    :global(.ant-card-head-title) {
      font-size: 16px;
    }
  }
}

.footer {
  background-color: #fff;

  /* 重置FormButtonGroup的默认样式 */
  :global {
    .button-group .inline {
      width: 100% !important;

      .inline-view {
        padding: 8px;
        zoom: 1;
        &::before,
        &::after {
          display: table;
          content: ' ';
        }
        &::after {
          clear: both;
          height: 0;
          font-size: 0;
          visibility: hidden;
        }
      }
    }
  }
}

.footerLeft {
  float: left;
}

.footerRight {
  float: right;
}

.mask {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1;
  &.holder {
    background-color: rgba(0, 255, 255, 0.1);
  }
  &.move {
    background-color: #ff7373;
    opacity: 0.15;
  }
}

.back {
  display: inline-block;
  width: 24px;
  color: @primary-color;
  text-align: center;
  cursor: pointer;
  &:hover {
    background-color: #f1f1f1;
  }
}
.helpIcon {
  margin-top: 6px;
  margin-left: 6px;
  color: @text-color-secondary;
}

.introduce {
  :global {
    .ant-tooltip-inner {
      width: 630px;
    }
  }
}

.delCol {
  margin-top: 12px;
  color: @text-color-secondary;
  font-size: 16px;
  cursor: pointer;
  &:hover {
    color: @error-color;
  }
}

.linkagesHelp {
  width: 260px;
  padding: 0 0 0 8px;

  :global {
    .ant-tag {
      position: relative;
      margin: 0 6px 6px 0;
      cursor: pointer;
      &:hover {
        color: @primary-color;
      }

      &.mark {
        &::after {
          position: absolute;
          top: 0;
          right: 0;
          width: 0;
          height: 0;
          border-top: 6px solid #31b968;
          border-left: 6px solid transparent;
          content: '';
        }
      }
    }
  }
}

.labelBold {
  :global {
    .ant-form-item-label {
      font-weight: bold;
    }
  }
}

.code {
  margin: 0 3px;
  padding: 0 0.2em;
  color: #faad14;
}

.marginLeft {
  margin-left: 4px;
}

.buttonGroup {
  min-height: 24px;
  background-color: #fff;
  :global(.ant-btn) {
    margin-right: 10px;
    &:last-child {
      margin-right: 0;
    }
  }
}

:global {
  .previewModal {
    &.ant-modal {
      position: absolute;
      top: 16px;
      right: 16px;
      bottom: 16px;
      left: 16px;
      width: auto !important;
    }
    .ant-modal-content {
      height: calc(100vh - 32px);
    }
  }

  .ant-collapse.cute {
    .ant-collapse-header {
      position: relative;
      padding: 6px 0 6px 32px;
      &::before {
        position: absolute;
        top: 50%;
        left: 16px;
        display: inline-block;
        width: 6px;
        height: 14px;
        margin-top: -7px;
        background-color: @blue-6;
        border-radius: 2px;
        content: '';
      }
    }

    &.ant-collapse-borderless > .ant-collapse-item {
      border-bottom: 0 !important;
    }

    &.ant-collapse-borderless
      > .ant-collapse-item
      > .ant-collapse-content
      > .ant-collapse-content-box {
      padding-top: 8px;
    }
  }
}
